package cn.doitedu.datayiee_service17.controller;

import cn.doitedu.datayiee_service17.pojo.SessionAgrBean;
import cn.doitedu.datayiee_service17.service.SessionAgrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@RestController
public class SessionAgrQueryController {

    @Autowired
    SessionAgrService sessionAgrService;

    @RequestMapping("/session/agr")
    public List<SessionAgrBean> getSessions(String dt,String startRow,Integer limit) throws Exception {

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date = sdf.parse(dt);
        long ts = date.getTime();

        List<SessionAgrBean> beanList = sessionAgrService.getSessions(ts, startRow, limit);

        return beanList;
    }


}
